﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static MrPP.SerriedCabinet.CabinetGroup;

namespace MrPP.SerriedCabinet
{/*
    public class CheckTemp : CheckPost
    {
        [SerializeField]
        private CheckModel _model;


        [SerializeField]
        private int tab  = 0;
        [SerializeField]
        private CheckPost.State state  = CheckPost.State.Close;
      
        // [SerializeField]
        //  private List<ArchivesData> _archives = new List<ArchivesData>();
        [SerializeField]
        private List<ItemData> _items = new List<ItemData>();


        [SerializeField]
        private int _waitPage = 0;

        [SerializeField]
        private int _checkPage = 0;
        [SerializeField]
        private int _otherPage = 0;

        [SerializeField]
        private List<string> _list = new List<string>();


        private Dictionary<string, ArchivesData> table_ = new Dictionary<string, ArchivesData>();


        void Start ()
        {
            _model.getTab = delegate { Debug.Log("tab:" + tab); return tab; };
            _model.getState = delegate { return state; };

            _model.getCheckList = delegate { return _list; };
         //   _model.getArchives = delegate { return _archives.ToArray(); };
            _model.getItems = delegate { return _items.ToArray();};
            _model.getWaitPage = delegate { return _waitPage; };
            _model.getCheckPage = delegate { return _checkPage; };
            _model.getOtherPage = delegate { return _otherPage; };

        }
        private void onWaitPage(int next)
        {
            var last = _waitPage;
            _waitPage = next;
            _model.onWaitPage(last, next);

        }
        private void onCheckPage(int next)
        {

            var last = _checkPage;
            _checkPage = next;
            _model.onCheckPage(last, next);
        }
        private void onOtherPage(int next)
        {
            var last = _otherPage;
            _otherPage = next;
            _model.onOtherPage(last, next);
        }
        public override void doLast()
        {
            switch (this.tab) {
                case 0:
                    onWaitPage(_waitPage-1);
                    break;
                case 1:
                    onCheckPage(_checkPage - 1);
                    break;
                case 2:
                    onOtherPage(_otherPage - 1);
                    break;
            }
          
        }

        public override void doNext()
        {
            switch (this.tab)
            {
                case 0:
                    onWaitPage(_waitPage + 1);
                    break;
                case 1:
                    onCheckPage(_checkPage + 1);
                    break;
                case 2:
                    onOtherPage(_otherPage + 1);
                    break;
            }

        }

        public override void doPlay()
        {

            string uri = Restful.RestfulManager.Uri("check");
            var op = Restful.RestfulManager.Instance.options(uri);

            var last = state;
            state = State.Loading;
            _model.onState?.Invoke(last, state);

            _items = new List<ItemData>();
            for (int i =0; i< 20; ++i) {

                ItemData a1 = new ItemData();
                a1.sn = "asdf:"+ i;
                a1.text = "春夏秋冬:"+i;
                a1.box = 0;
                a1.layer = 0;
                a1.sile = i%3;
                _items.Add(a1);
            }
          
           
            //_model.onArchives?.Invoke(_items.ToArray());
            _model.onItems?.Invoke(_items.ToArray());

             var last2 = state;
            state = State.Running;
            _model.onState?.Invoke(last2, state);
       
        }

        public override void doStop()
        {
            var last = state;
            state = State.Close;
            _model.onState?.Invoke(last, state);
        }

        public override void doTab(int idx)
        {
            var last = tab;
            tab = idx;
            _model.onTab?.Invoke(last, idx);
        }

        public override void doCheck(string key)
        {
           // Debug.LogError(key);
            foreach (var k in _list) {
                if (key == k) {
                    return;
                }
            }
            _list.Add(key);

            _model.onCheckList?.Invoke(_list);
        }
    }
    */
    
}